/**
 *  Copyright 2011 Marco Berri - marcoberri@gmail.com
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations under the License.
 **/
package com.mbfasttrack.model;

import java.util.Date;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * @author Marco Berri marcoberri@gmail.com http://tecnicume.blogspot.com
 */
@Document
public class Action implements Base {

    @Id
    @Indexed
    private String id;
    private String description;
    @DBRef
    private User user;
    @DBRef
    private Base object;
    private String objectname;
    private Base target;
    private String targetname;
    private Date dateSaved = new Date(System.currentTimeMillis());

    /**
     * 
     * @return
     */
    public String toString() {
        return "[ id: " + this.id
                + " description:" + this.description
                + " user:" + this.user
                + " object:" + this.object
                + " objectname:" + this.objectname
                + " target:" + this.target
                + " targetname:" + this.targetname
                + " dateSaved:" + this.getDateSaved()
                + " ]";
    }

    /**
     * 
     */
    public Action() {
    }

    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the user
     */
    public User getUser() {
        return user;
    }

    /**
     * @param user the user to set
     */
    public void setUser(User user) {
        this.user = user;
    }

    /**
     * @return the object
     */
    public Base getObject() {
        return object;
    }

    /**
     * @param object the object to set
     */
    public void setObject(Base object) {
        this.object = object;
    }


    /**
     * @return the dateSaved
     */
    public Date getDateSaved() {
        return dateSaved;
    }

    /**
     * @param dateSaved the dateSaved to set
     */
    public void setDateSaved(Date dateSaved) {
        this.dateSaved = dateSaved;
    }

    /**
     * @return the objectname
     */
    public String getObjectname() {
        return objectname;
    }

    /**
     * @param objectname the objectname to set
     */
    public void setObjectname(String objectname) {
        this.objectname = objectname;
    }

    /**
     * @return the target
     */
    public Base getTarget() {
        return target;
    }

    /**
     * @param target the target to set
     */
    public void setTarget(Base target) {
        this.target = target;
    }

    /**
     * @return the targetname
     */
    public String getTargetname() {
        return targetname;
    }

    /**
     * @param targetname the targetname to set
     */
    public void setTargetname(String targetname) {
        this.targetname = targetname;
    }
}
